var Timer = function(setupCb, drawCb, doneCb, frames){
	
	var FRAMES_TO_DRAW = frames || 1000;
	
	var setup = setupCb || function(cb){ cb();};
	var draw = drawCb || function(cb){ cb(); };
	var done = doneCb || function(){};
	
	var startTime;
	
	this.run = function(){
		setup(function(){
			startTime = new Date().getTime();
			render(0);
		});
	};
	
	var getFramerate = function(time){
		var fr = FRAMES_TO_DRAW/(time/1000.);
		return Math.round(fr*100)/100;
	}
	
	var render = function(i){
		if(i < FRAMES_TO_DRAW){
			draw(function(){
				render(i+1);
			});
		} else {
			var time = new Date().getTime() - startTime;
			done(time, getFramerate(time));
		}
	};
	
};